<?php
//短信发送类
class smsMod extends base {

	//短信发送
	public function send() {		

		$mobile = $_POST['mobile'];
		$send_code = $_POST['send_code'];
		
		$mobile_code = random(6,1);
		if(empty($mobile)){
			exit('手机号码不能为空');
		}
		
		if(empty($_SESSION['send_code']) or $send_code!=$_SESSION['send_code']){
			//防短信轰炸机
			exit('非法请求');
		}
		//验证手机是否已注册
		$data = array('Mobile'=>$mobile);
		$client = post_curl($data, 'MEMBER_CHECK_MOBILE');
		if($client['status']){
			if($client['Msg'][0]['IsReg']==1) exit('该手机已注册');
		}else{
			$this -> error(lang::get($client['status']));
		}
		//发送短信
		$data = array('Mobile'=>$mobile,'BusinessNo'=>'0000','Code'=>$mobile_code);
		$client = post_curl($data, 'SMS_SEND');
		if($client['status']){
			$_SESSION['mobile'] = $mobile;
			$_SESSION['mobile_code'] = $mobile_code;			
			exit('短信发送成功');
		}else{
			$this -> error(lang::get($client['status']));
		}
		

	}

	

}


?>